import 'dart:convert';

NoticeEntity noticeEntityFromJson(String str) => NoticeEntity.fromJson(json.decode(str));

String noticeEntityToJson(NoticeEntity data) => json.encode(data.toJson());

class NoticeEntity {
  int total;
  List<ListElement> list;
  int current;

  NoticeEntity({
    required this.total,
    required this.list,
    required this.current,
  });

  factory NoticeEntity.fromJson(Map<String, dynamic> json) => NoticeEntity(
    total: json["total"],
    list: List<ListElement>.from(json["list"].map((x) => ListElement.fromJson(x))),
    current: json["current"],
  );

  Map<String, dynamic> toJson() => {
    "total": total,
    "list": List<dynamic>.from(list.map((x) => x.toJson())),
    "current": current,
  };
}

class ListElement {
  int? id;
  String? href;
  String? content;
  DateTime? createdAt;
  DateTime? updatedAt;
  dynamic? deletedAt;
  int? status;
  String? title;

  ListElement({
    required this.id,
    required this.href,
    required this.content,
    required this.createdAt,
    required this.updatedAt,
    required this.deletedAt,
    required this.status,
    required this.title,
  });

  factory ListElement.fromJson(Map<String, dynamic> json) => ListElement(
    id: json["id"],
    href: json["href"],
    content: json["content"],
    createdAt: DateTime.parse(json["created_at"]),
    updatedAt: DateTime.parse(json["updated_at"]),
    deletedAt: json["deleted_at"],
    status: json["status"],
    title: json["title"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "href": href,
    "content": content,
    "created_at": createdAt?.toIso8601String(),
    "updated_at": updatedAt?.toIso8601String(),
    "deleted_at": deletedAt,
    "status": status,
    "title": title,
  };
}
